package com.linkoog.devtools.http.request.common.request_body;

import com.linkoog.devtools.http.request.common.RequestBody;
import com.linkoog.devtools.http.request.common.RequestBodyType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;

@Setter @Getter
public class MultipartFormRequestBody implements RequestBody {
    private List<MultipartFormItem> dataList;

    public MultipartFormRequestBody() {
    }

    public MultipartFormRequestBody(List<MultipartFormItem> dataList) {
        this.dataList = dataList;
    }

    public static MultipartFormRequestBody of(List<MultipartFormItem> dataList) {
        return new MultipartFormRequestBody(dataList);
    }

    @Override
    public String toString() {
        return "FormBodyParam{" +
                "dataList=" + dataList +
                '}';
    }

    @Override
    public RequestBodyType bodyType() {
        return RequestBodyType.MULTIPART_FORM;
    }

    @NoArgsConstructor
    @AllArgsConstructor
    @Setter @Getter
    public static class MultipartFormItem{
        private boolean file;
        private String name;
        private String value;

        @Override
        public String toString() {
            return "MultipartFormItem{" +
                    "file='" + file + '\'' +
                    ", name='" + name + '\'' +
                    ", value='" + value + '\'' +
                    '}';
        }
    }

}
